package com.dzzw.Service;

import com.dzzw.Dao.UserDao;
import com.dzzw.Model.User;
import com.dzzw.utils.Page;

import java.util.List;

public class UserService {
    private final UserDao userDao = new UserDao();

    public Page<User> FindAllUser(int pageIndex, int pageSize) {
        // 实例化Page对象
        Page<User> page = new Page<>();
        // 获取查询结果集
        List<User> userList = userDao.FindAllUser(pageIndex, pageSize);
        // 对PageUtils对象进行赋值
        page.setDataList(userList);
        page.setPageIndex(pageIndex);
        page.setPageSize(pageSize);
        page.setTotalCount(userDao.count());
        // 返回Page对象
        return page;
    }
}
